<?php
require_once 'Zend/Controller/Action.php';

require_once 'Zend/Feed.php';

class FeedController extends Zend_Controller_Action 
{
    public function indexAction() 
    {
        $this->_redirect('/');
    }

    public function rssAction() {
        $config = Zend_Registry::get('config');
        $link = $this->view->host ? $this->view->host : 'http://kbs.info';
        $channel = array(
            'title' => 'KBS',
            'link' => $link,
            'description' => 'All the latest articles',
            'charset' => 'utf-8',
            'entries' => array(),
            );

        $channel['entries'][] = array(
            'title' => 'title 1',
            'link' => 'http://places/article/index/id/1/',
            'description' => 'body 1',
            );

        $feed = Zend_Feed::importArray($channel, 'rss');
        
        $this->getHelper('viewRenderer')->setNoRender();
        $this->view->layout()->disableLayout();

        echo $feed->send();
        //echo $feed->saveXML();

        exit();
    }

    public function readerAction() {

        $feedImport = Zend_Feed::import('http://www.zend.com/en/company/news/news-links/feed');

        $this->getHelper('viewRenderer')->setNoRender();
        $this->view->layout()->disableLayout();

        echo $feedImport->send();

        exit();
    }
}